﻿-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE UploadPic
	@ProfileID bigint,
	@FilePath varchar(100)
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	DECLARE @MediaID bigint
	
	INSERT INTO MediaLibrary(MediaType, MediaPath, UploadedDate)
	VALUES(1,@FilePath, GETDATE())
	
	SET @MediaID = (SELECT SCOPE_IDENTITY())
	
	UPDATE ProfileInfo
	SET ProfilePicID = @MediaID
	WHERE ProfileID=@ProfileID
END
